<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>新闻添加</title>

    <meta name="keywords" content="">
    <meta name="description" content="">

    <!--[if lt IE 8]>
    <script>
        alert('H+已不支持IE6-8，请使用谷歌、火狐等浏览器\n或360、QQ等国产浏览器的极速模式浏览本页面！');
    </script>
    <![endif]-->

    <link href="/static/admin/public/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/static/admin/public/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/static/admin/public/css/animate.min.css" rel="stylesheet">
    <link href="/static/toastr/toastr.min.css" rel="stylesheet"></link>
    <link href="/static/admin/public/css/style.min.css?v=3.2.0" rel="stylesheet">
    <link href="/static/admin/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css?v=3.2.0" rel="stylesheet">
    <link href="/static/index/util/webuploader/webuploader.css?v=3.2.0" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins" >
        <div class="ibox-title">
            <h5>添加</h5>
        </div>
        <div class="ibox-content">
            <form id="commentForm" class="form-horizontal m-t dropzone" enctype="multipart/form-data">
                <div class="form-group"><label class="col-sm-2 control-label">企业logo：</label>
                    <div class="col-sm-10">
                        <img style="max-width: 400px;max-height: 200px" v-bind:src="imageUrl" alt="公司logo">
                        <input ref="inputer" style="display: none" type="file" @change="changepic()" accept="image/png, image/jpeg, image/gif, image/jpg" name="file" id="file" />
                        <label for="file" class='btn btn-success'>点击上传</label>
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">公司名称：</label>
                    <div class="col-sm-10">
                        <input v-model="name" name="name" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">注册时间：</label>
                    <div class="col-sm-4">
                        <input autoComplete="off" v-model="summary" id="layDate" placeholder="请选择日期" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">注册资本：</label>
                    <div class="col-sm-4">
                        <input v-model="fund"   name="summary" minlength="2" type="text" required="required" class="form-control">

                    </div>
                    <div class="col-sm-4">
                        万元
                    </div>
                </div>
                <div class="form-group" data-toggle="distpicker">
                    <label class="col-sm-2 control-label">归属地：</label>
                    <div class="col-sm-3">
                        <select v-model="province" class="form-control m-b" name="account" data-province="---- 选择省 ----">
                            <option>选项 1</option>
                            <option>选项 2</option>
                            <option>选项 3</option>
                            <option>选项 4</option>
                        </select>
                    </div>
                    <div class="col-sm-3">
                        <select v-model="city" class="form-control m-b" name="account" data-city="---- 选择市 ----">
                            <option>选项 1</option>
                            <option>选项 2</option>
                            <option>选项 3</option>
                            <option>选项 4</option>
                        </select>
                    </div>
                    <div class="col-sm-3">
                        <select v-model="district" class="form-control m-b" name="account" data-district="---- 选择区 ----">
                            <option>选项 1</option>
                            <option>选项 2</option>
                            <option>选项 3</option>
                            <option>选项 4</option>
                        </select>
                    </div>
                </div>

                <div class="form-group"><label class="col-sm-2 control-label">详细地址：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">官网地址：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">公司简介：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>

                <div class="form-group"><label class="col-sm-2 control-label">注册时间：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">联系人：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">职位：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">手机号：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">固定电话：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">邮箱地址：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">微信号：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">所述行业：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">预算金额：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                        万元/年
                    </div>

                </div>
                <div class="form-group"><label class="col-sm-2 control-label">发货量：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                        吨/年
                    </div>

                </div>
                <div class="form-group"><label class="col-sm-2 control-label">主要路线：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label">服务要求：</label>
                    <div class="col-sm-10">
                        <input v-model="summary" name="summary" minlength="2" type="text" required="required" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-3">
                        <button type="button" @click="testPost()" class="btn btn-primary">暂存</button>
                        <button type="button" @click="testPost()" class="btn btn-primary">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="/static/admin/public/js/jquery-2.1.1.min.js"></script>
<script src="/static/admin/public/js/bootstrap.min.js?v=3.4.0"></script>
<script src="/static/admin/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/admin/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/static/admin/plugins/layer/layer.min.js"></script>
<script type="text/javascript" src="/static/vue/vue.js"></script>

<!-- 自定义js -->
<script type="text/javascript" src="/static/util/axios.min.js"></script>
<script type="text/javascript" src="/static/admin/api/require.js"></script>
<script type="text/javascript" src="/static/admin/api/publicAjax.js"></script>

<!-- 第三方插件 -->

<script src="/static/toastr/toastr.min.js"></script>
<script src="/static/toastr/customToastr.js"></script>

<script src="/static/admin/plugins/validate/jquery.validate.min.js"></script>
<script src="/static/admin/plugins/validate/messages_zh.min.js"></script>
<!--全国省份-->
<script src="/static/util/distpicker/distpicker.min.js"></script>
<!--时间组件-->
<script src="/static/util/laydate/laydate.js"></script>
<!--编译器-->
<!-- 配置文件 -->
<script>
    $('#target').distpicker();
    laydate.render({
        elem: '#layDate' //指定元素
    });
    var vmAddChannel = new Vue({
        el:"#commentForm",
        data:{
            province:'',//省份
            city:'',//市
            district:'',//区或者县
            name:'',            //公司名称
            content:'',         //
            summary:'',         //注册时间
            fund:'',            //注册资金
            home_address:'',    //详细地址
            website_url:'',     //官方网站
            company_info:'',    //公司简介
            contacts:'',        //联系人
            position:'',        //职位
            landine_phone:'',   //固定电话
            mobile:'',          //手机号
            email:'',           //邮箱
            wechat:'',          //微信
            trade_id:'',        //行业ID
            budget:'',          //预算金额
            shipment:'',        //发货量
            line:'',            //主要路线
            service_content:'', //服务要求
            imageUrl:''
        },
        computed:{
            //计算属性 生成公司所在地
            address:function () {
                return this.province+this.city+this.district
            }
        },
        methods:{
            changepic:function(){
                var el = this;
                var inputDOM = el.$refs.inputer;
                var files = inputDOM.files;
                var formData = new FormData();
                formData.append('files',files[0]);
                AjaxPost(formData,'/index/image/upload').then((response=>{
                    if(response.status==1){
                        $.customToastr('success',response.message)
                        this.imageUrl = response.result
                    }
                    console.log(response);
                }))
            },

            addContent:function () {
                let el = this;

                if($("#commentForm").valid()){
                    let postData = {
                        'title':el.title,
                        'content':'',
                        'summary':el.summary
                    }
                    AjaxPost(postData,'/admin/news/addNews').then((response=>{
                        console.log(response);
                        if(response.status==1){
                            $.customToastr('success',response.message)
                            setTimeout(()=>{
                                window.location.href='/admin/news/index'
                            },1000)
                        }
                    }))
                }
            },
            testPost:function () {
                console.log(this.address)
            }
        },
        mounted(){
        },
        watch:{
            imageNamess:function (val) {
                console.log(val)
            }
        }
    })
</script>

</body>

</html>